<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<style type="text/css">
			*{margin: 0;padding: 0;list-style: none;box-sizing: border-box;}
			div{width:300px;height:200px;border: 1px solid red;text-align: center;line-height:200px;display: none;}
			ul{overflow: hidden;}
			li{width:100px;height:50px;border: 1px solid red;line-height: 50px;text-align: center;float: left;}
		</style>
	</head>
	<body>
		<ul>
			<li>选项一</li>
			<li>选项二</li>
			<li>选项三</li>
		</ul>
			<div style="display: block;">内容一</div>
			<div>内容二</div>
			<div>内容三</div>
	</body>
	<script type="text/javascript">
		var odiv=document.getElementsByTagName("div");
		var oli=document.getElementsByTagName("li");
		for(var i=0;i<oli.length;i++){
			-function(x){
				oli[x].onclick=function(){
					for(var j=0;j<odiv.length;j++){
						odiv[j].style.display="none"
					}
					odiv[x].style.display="block"
				}
			}(i)
		}
	</script>
</html>
